<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

require_once ('../db_conn.php');
$sql="SELECT * FROM tb_newstype ORDER BY id DESC LIMIT 1";
$a5s=$db->query($sql);
$c5=$a5s->fetch_array(MYSQLI_BOTH);
$rec=isset($_GET['rec'])?$_GET['rec']:"";
if ($rec=='insert')
{
    $typename=$_POST['typename'];
    $id=$_POST['sort'];
    $sql="insert into tb_newstype(id,typename) values('$id','$typename')";
    $rs=$db->query($sql);
        if ($rs==FALSE)
    {
        echo "<script language='javascript' type='text/javascript'>";
        echo "alert('添加失败！');";
        echo "window.location.href='add_product_category_html.php'";
        echo "</script>";
    }
    else
    {
        echo "<script language='javascript' type='text/javascript'>";
        echo "alert('添加成功！');";
        echo "window.location.href='product_category.php'";
        echo "</script>";  
    }

}

require 'add_product_category_html.php';


$a5s->free();


$db->close();
